from multiprocessing import Process
from multiprocessing import Queue
from time import sleep

def download(q):
    images = ['a.jpg','b.jpg','c.jpg','d.jpg','e.jpg']
    for image in images:
        print('正在下载图片:',image)
        sleep(0.5)
        q.put(image)

def getfile(q):
    while True:
        try:
            file = q.get(timeit = 5)
            print('{}保存成功!'.format(file))
        except:
            print('全部保存完毕！')
            break

if __name__ == '__main__':
    q = Queue(5)
    p1 = Process(target=download,args=(q,))
    p2 = Process(target=getfile,args=(q,))

    p1.start()
    p1.join()

    p2.start()
    p2.join()

    print('主进程结束')